from enum import Enum


class Resource(object):
    """
    资源信息
    """
    name: str = None
    type: int = None
    table: str = None

    def __init__(self, name, type, table):
        self.name = name
        self.type = type
        self.table = table


class ResourceType(Enum):
    """
    资源类型
    """
    CARRY = 1
    UNIT = 2
    CENTER = 3
    TRANSPORT = 4

    def is_movable(self) -> bool:
        """
        是否为移动类型资源
        - 移动类型资源 需要记录前后位置数据
        - 非移动类型资源 起始、终点位置均为自身
        :return:
        """
        return self in (ResourceType.CARRY, ResourceType.TRANSPORT)


class ResourceConfig(object):
    """
    资源配置
    """

    RESOURCE_TYPE_MAP = {}


# 资源配置
ResourceConfig.RESOURCE_TYPE_MAP[ResourceType.CARRY] = Resource('搬运设备', 1, 'wops_carry_equ')
ResourceConfig.RESOURCE_TYPE_MAP[ResourceType.UNIT] = Resource('工作单元设备', 2, 'wops_work_unit_equ')
ResourceConfig.RESOURCE_TYPE_MAP[ResourceType.CENTER] = Resource('工作中心', 3, 'wops_work_center_equ')
ResourceConfig.RESOURCE_TYPE_MAP[ResourceType.TRANSPORT] = Resource('传输设备', 4, 'wops_transport_equ')
